<?php 
require_once 'Image.php';
require_once 'Database.php';
require_once 'News.php';
$db=new DB();
$imageArr = $db->allHeaderImages();
$newsArr = $db->allHeaderNews();
?>

  <!-- content -->
  <div id="content">
    <div class="wrapper">
		<div class="content">
	        <div class="indent">
	        	<div>
	        		<table width= "880" height='250'>
			          	<?php 
							if ($newsArr[0]->getOrder() == 1){	
								$article_name = $db->takeArticleName($newsArr[0]->getId());					
								echo 	"<tr><td cowspan='3' height='30'><h2>".$newsArr[0]->getName()."</h2></td></tr>";
								echo 	"<tr><td rowspan='2' width='300' height='200'><img class='img-indent png' alt='".$newsArr[0]->getName()."'  src='images/gallery/".$newsArr[0]->getImage()."'width='300' height='200'></td>";
								echo 	"<td height='175' colspan='2'><p class='alt-top'>".$newsArr[0]->getText()."</p></td></tr>";
								echo 	"<tr><td></td><td height='22' width='90'><p class='button'><span><span><a href='?page=MKbutton&article=".$article_name."'>Прочетете още</a></span></span></p></td></tr>";
								
								
								
							}
						?>
					</table>
	         	</div>
	         
	         
	          <div class="clear"></div>
	          <div class="line-hor"></div>
	          	<div class="wrapper line-ver">
	          		
			          <?php 
						
						if ($newsArr[0]->getOrder() == 1){ 
							array_shift($newsArr);
						}
						$n=count($newsArr);
						for ($i=0;$i<$n;$i++){
							$article_name = $db->takeArticleName($newsArr[$i]->getId());
							if ($i+1 % 3 == 3) {
								echo "<div class='col-3'><table height='550'>";
							} else {
								echo "<div class='col-".(($i+1)%3)."'><table  height='550'>";
							};
							echo "<tr><td height='45'><h3>".$newsArr[$i]->getName()."</td></tr></h3>";
							echo "<tr><td height='155'><p><img src='images/gallery/".$newsArr[$i]->getImage()."'width='250' height='150' alt=''></p></td></tr>";
							echo "<tr><td><p>".$newsArr[$i]->getText()."</p></td></tr>";
							echo "<tr><td height='91em'><p class='button'><span><span><a href='?page=MKbutton&article=".$article_name."'>Прочетете още</a></span></span></p></td></tr>";
							echo "</table></div>";
						}
		
					?>
	          	
	          </div>
	        </div>
      </div>
    </div>
  </div>
